﻿using JMBox.Utils;
using static JMBox.Config.R;

namespace JMBox.Task
{
    public class ConnectNetTask
    {
        /// <summary>
        /// 工作内容
        /// </summary>
        private void InnerRun()
        {
            WiFiTool.ConnectWiFiNet();
        }

        /// <summary>
        /// 开始执行任务
        /// </summary>
        public void Start()
        {
            //检查1：是否已经开始连网
            if (GlobalStatus.IsConnectNeting)
            {
                return;
            }
            //标记开始断网状态
            GlobalStatus.IsConnectNeting = true;
            //执行任务
            try
            {
                InnerRun();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            //修改任务执行状态
            GlobalStatus.IsConnectNeting = false;

        }

        /// <summary>
        /// 结束任务
        /// </summary>
        public void End()
        {
            
        }
    }
}